Skip to content

Restart mechanism with a wall-time budget - #92

Merged
romainljsimon merged 3 commits into
TheDisorderedOrganization:mainfrom
cyfraysse:native-restart
Oct 8, 2026
Merged

romainljsimon merged 3 commits into
TheDisorderedOrganization:mainfrom
cyfraysse:native-restart

Conversation

@cyfraysse

Copy link
Copy Markdown
Contributor

Add the engine primitives so a simulation can run longer than an HPC walltime by stopping cleanly and resuming later:

  • run!(; wall_time): stop on a wall-clock budget, return :completed or :need_restart; short-circuit guard for schedulers that end before steps
  • Simulation gains a t_start field/kwarg: resume at t_start and skip already-completed schedule points
  • Store{Callbacks,Trajectories,Acceptance} open output files in append mode on restart (t_start > 0); file opening moved from constructors into initialise; store_first no longer re-fires on restart; summary.log appended

Note : Engine in order to use it with ParticlesMC (see PR of the same name in ParticlesMC repo).

Add the engine primitives so a simulation can run longer than an HPC
walltime by stopping cleanly and resuming later:

- run!(; wall_time): stop on a wall-clock budget, return :completed or
  :need_restart; short-circuit guard for schedulers that end before steps
- Simulation gains a t_start field/kwarg: resume at t_start and skip
  already-completed schedule points
- Store{Callbacks,Trajectories,Acceptance} open output files in append
  mode on restart (t_start > 0); file opening moved from constructors into
  initialise; store_first no longer re-fires on restart; summary.log appended

Tests: test/restart_test.jl (5 testsets, 20 assertions), wired into suite.
@codecov

codecov Bot commented Sep 23, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.90909% with 3 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/simulation.jl 88.00% 3 Missing ⚠️
Files with missing lines Coverage Δ
src/algorithms.jl 93.93% <100.00%> (+0.55%) ⬆️
src/metropolis.jl 92.15% <100.00%> (-0.11%) ⬇️
src/simulation.jl 81.53% <88.00%> (+0.34%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@romainljsimon
romainljsimon self-requested a review September 24, 2026 21:04

@V-Francois V-Francois left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think edge cases could be handled a bit better, without spreading the logic over multiple parts of the code.
Happy to discuss this if someone disagrees.

Comment thread src/simulation.jl Resolved
Comment thread src/simulation.jl Resolved

@romainljsimon romainljsimon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the nice PR @cyfraysse !!
I have one comment on defining the default value of status as :completed, else I find this PR great.

Comment thread src/simulation.jl Resolved

@V-Francois V-Francois left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM now!

@romainljsimon romainljsimon left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks :) I added a catch for when the simulation fails

@V-Francois

Copy link
Copy Markdown

Can you bump the version (the patch I guess since it's still in 0), so we can merge and release?

@romainljsimon
romainljsimon merged commit 9767da3 into TheDisorderedOrganization:main Oct 8, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants